  {extend name="Public:user_base" /}
              {block name="seo"}
         <title>个人消息|{$Think.CONFIG.WEB_SITE_TITLE} - Powered by EasySNS!</title>
  
  
  <meta name="keywords" content="{$Think.CONFIG.WEB_SITE_KEYWORD}">
  <meta name="description" content="{$Think.CONFIG.WEB_SITE_DESCRIPTION}">
      {/block}
  {block name="body"}

<div class="ucenter-right">
<div class="myaccount-head  es-tabli">
<ul>
<li class="current" data-id="mymess">我的消息</li>


</ul>
</div>
<div class="es-tabcontent">
<div id="mymess" >
<div class="mymessage-box" id="myMessage">
<h2>全部消息<a class="clearAll" style="display: inline;"><i class="fa fa-times"></i>清空当前消息</a>
<a style="display:none" href="/user/mysetting" class="message-setting"><i class="fa fa-gear"></i>消息设置</a></h2>
<div class="myMessage">
<ul id="listMsg">
   {volist name="list" id="vo"} 
        <p class="date hide">{$vo.update_time|friendlyDate}</p>
    
    <li data-msgid="9829768042">
        <h3 class="title">{if condition="$vo['uid'] eq 0"}系统消息{else/}{:getusernamebyid($vo['uid'])}{/if}&nbsp;&nbsp;<span class="time">{$vo.update_time|friendlyDate}</span>
        <i class="fa fa-times deletemsg" onclick="deletemess(this,{$vo.id},{$vo.uid});"></i>
        {if condition="$vo['uid'] gt 0"}
        <span class="deletemsg" style="margin-right:50px;"><a href="{:url('user/wmessage',array('touid'=>$vo.uid))}" target="_blank">回复</a></span>
        {/if}
        
        </h3>
        
            <p class="msg-body">{$vo.content}
            </p>
        
    </li>
          
    {/volist}
</ul>
					<div class="pages">
						<ul class="pagination">
						{$list->render()}
						</ul>
					</div>
				</div>
</div>
</div>


</div>


</div>
    {/block}
    {block name="script"}
    <script>
    function deletemess(obj,id,uid){
    	
	    $.post("{:url('user/ajaxdelmess')}",{id:id,uid:uid},function(data){
		    
	    	
	    	
	    	
		      if(data.code == 1){
			        
			        layer.msg(data.msg, {icon: 1, time: 1000}, function(){
			               $(obj).closest('li').slideUp("slow");
			        });
			      }else{
			        
			        layer.msg(data.msg, {icon: 2, anim: 6, time: 1000});
			        
			        
			        
			   }
		
  	

  });
    	
    	
    	
    }
    $(function(){
    	
    	
    	
    	$('.clearAll').click(function(){
    		layer.confirm('确定清空所有信息吗？',{icon:3, title:'提示信息'},function(index){
    		    loading = layer.load(2, {
    			      shade: [0.2,'#000']
    			    });
    		   
    			
    			    $.getJSON("{:url('user/ajaxdelallmess')}",function(data){
    			    	
    			      if(data.code == 1){
    			        layer.close(loading);
    			        layer.msg(data.msg, {icon: 1, time: 1000}, function(){
    			        	location.reload();
    			        });
    			      }else{
    			        layer.close(loading);
    			        layer.msg(data.msg, {icon: 2, anim: 6, time: 1000});
    			      }
    			    });
    		});

    		
    	});
    	
    	
    	$('#mymess li').hover(function(){
    		
    		$(this).find('.deletemsg').show();
    		
    	},function(){
    		$(this).find('.deletemsg').hide();
    		
    	});
    	
    	
    	
    })
    
    </script>
    
    {/block}